package com.burgeon.backend.EnterpriseWeChat.controller;

import com.burgeon.backend.EnterpriseWeChat.entity.ReVip;
import com.burgeon.backend.EnterpriseWeChat.entity.Referral;
import com.burgeon.backend.EnterpriseWeChat.entity.VipContact;
import com.burgeon.backend.EnterpriseWeChat.entity.WardrobeData;
import com.burgeon.backend.EnterpriseWeChat.service.EWVipWardrobeService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("ewapp/wardrobe")
public class EWVipWardrobeController extends EWBaseController {
    @Autowired
    private EWVipWardrobeService ewVipWardrobeService;
    /**
     * 衣橱
     * @param token
     * @param vipCardNo
     * @return
     */
    @RequestMapping("getVipWardrobe")
    public ResponseResult< ArrayList<WardrobeData> > getVipWardrobe(String token, String vipCardNo){
        ArrayList<WardrobeData>  data = ewVipWardrobeService.getVipWardrobe(token,vipCardNo);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 其他联系方式
     * @param token
     * @param vipId
     * @return
     */
    @RequestMapping("getVipContactInfo")
    public ResponseResult<VipContact> getVipContactInfo(String token, String vipId){
        VipContact data = ewVipWardrobeService.getVipContactInfo(token,vipId);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 保存联系方式
     * @param token
     * @param vipId
     * @param vipContact
     * @return
     */
    @RequestMapping("saveUserBasicInfo")
    public ResponseResult<Void> saveUserBasicInfo(String token, String vipId, VipContact vipContact){
        ewVipWardrobeService.saveUserBasicInfo(token,vipId,vipContact);
        return new ResponseResult<>(SUCCESS);
    }

    /**
     * 转介绍
     * @param token
     * @param vipId
     * @return
     */
    @RequestMapping("getReferralList")
    public ResponseResult<ArrayList<Referral>> getReferralList(String token, String vipId){
        ArrayList<Referral> data = ewVipWardrobeService.getReferralList(token,vipId);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 删除转介绍
     * @param token
     * @param id
     * @return
     */
    @RequestMapping("deleteReferralList")
    public ResponseResult<Void> deleteReferralList(String token, String id){
        ewVipWardrobeService.deleteReferralList(token,id);
        return new ResponseResult<>(SUCCESS);
    }

    /**
     * 新增转介绍
     * @param token
     * @param cardNo
     * @param referral
     * @return
     */
    @RequestMapping("createReferral")
    public ResponseResult<String> createReferral(String token, String cardNo, Referral referral){
        String data = ewVipWardrobeService.createReferral(token, cardNo, referral);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 修改转介绍
     * @param token
     * @param referral
     * @return
     */
    @RequestMapping("modifyReferral")
    public ResponseResult<Void> modifyReferral(String token, Referral referral){
        ewVipWardrobeService.modifyReferral(token,referral);
        return new ResponseResult<>(SUCCESS);
    }

    /**
     * 画像
     * @param token
     * @param vipCardNo
     * @return
     */
    @RequestMapping("getVipFearture")
    public ResponseResult<HashMap> getVipFearture(String token, String vipCardNo){
        HashMap data = ewVipWardrobeService.getVipFearture(token,vipCardNo);
        return new ResponseResult<>(SUCCESS,data);
    }


    /**
     * 推荐的用户的信息
     */
    @RequestMapping("getReVips")
    public ResponseResult<List<ReVip>> getReVips(String token, String phone){
        List<ReVip> data = ewVipWardrobeService.getDataByRid(token,phone);
        return new ResponseResult<>(SUCCESS,data);
    }

}
